﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MoneyWentWhere.DataModel.Reports
{
    public class ExpenseByAccountReport : ExpenseReport<Account>
    {
        Dictionary<Guid, int> _columnIndexes = new Dictionary<Guid, int>();

        public ExpenseByAccountReport(TimeSpanUnit periodUnit) : base(periodUnit) { }

        protected override List<Account> CreateColumns(MoneyDataSet dataSet)
        {
            List<Account> acs = new List<Account>(dataSet.Accounts);

            for (int i = 0; i < acs.Count; i++)
            {
                _columnIndexes.Add(acs[i].Guid, i);
            }


            return acs;
        }

        protected override int GetColumnIndex(Transaction tx)
        {
            return _columnIndexes[tx.Account.Guid];
        }
    }
}
